fix: meshd watch replays full event history on start#24
Merged
Conversation
runWatch started with since=0, causing Syncthing's entire event log to flood stdout on launch. Call InitEventID() before the event loop to establish a session baseline, matching how the MCP server and TUI handle it. Affects both the streaming mode and --until mode.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
meshd watchfloods stdout with the entire Syncthing event history on launch — hundreds of connect/disconnect/scan events all with the same timestamp. Makes it unusable as a live event stream.Root cause
runWatchstarts withsince := 0, which tells Syncthing "give me all events from the beginning." The MCP server and TUI both callclient.InitEventID()before entering their event loops to establish a session baseline —runWatchwas missing this call.Fix
One line: call
client.InitEventID()at the top ofrunWatch, before the--untilbranch and the streaming loop. Both paths now start from the current event ID.Before / After
Before: launches and immediately prints hundreds of historical events
After: starts clean, only prints events that occur after launch
🤖 Generated with Claude Code